{extend name="AdminEx/index" /}

{block name="main"}
<!-- page heading start-->
<div class="page-heading">
    <h3>
        {$title}
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">Dashboard</a>
        </li>
        <li>
            <a href="#">Data Table</a>
        </li>
        <li class="active"> Editable Table</li>
    </ul>
</div>
<!-- page heading end-->

<!--body wrapper start-->
<div class="wrapper">
    <div class="row">
        <div class="col-sm-12">
            <section class="panel">
                <header class="panel-heading">
                    查看分类
                    <span class="tools pull-right">
                        <a href="javascript:;" class="fa fa-chevron-down"></a>
                        <a href="javascript:;" class="fa fa-times"></a>
                     </span>
                </header>
                <div class="panel-body">
                    <div class="adv-table editable-table ">
                        <div class="clearfix">
                            <div class="btn-group">
                                <a href="{:url('admin/Category/create')}">
                                    <!--<button class="btn btn-primary"><a href="{:url('admin/Link/save')}">添加出版社</a> <i class="fa fa-plus"></i></button>-->
                                </a>
                            </div>
                            <div class="btn-group pull-right">
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">Tools <i
                                        class="fa fa-angle-down"></i>
                                </button>
                                <ul class="dropdown-menu pull-right">
                                    <li><a href="#">Print</a></li>
                                    <li><a href="#">Save as PDF</a></li>
                                    <li><a href="#">Export to Excel</a></li>
                                </ul>
                            </div>
                        </div>
                        <div class="space15"></div>
                        <table class="table table-striped table-hover table-bordered" id="editable-sample">
                            <thead>
                            <tr>
                                <th>id</th>
                                <th>分类名</th>
                                <th>分类级别</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            {volist name="list" id="v"}
                            <tr class="">
                                <td>{$v.id}</td>
                                <td>{$v.name}</td>
                                <td>{$v.pid>0?'书名':'出版社名'}</td>
                                <td>{$v.status==0?'未显示':'已显示'}</td>
                                <td><a data-id="{$v['id']}" href="{:url('admin/Link/change',['id'=>$v['id']])}">

                                    <button class="btn btn-success btn-sm" type="button">更改状态</button>
                                </a>
                                <!--<a  href="{:url('admin/Category/add',['id'=>$v['id']])}">-->

                                    <!--<button class="btn btn-success btn-sm" type="button">添加旗下书本名</button>-->
                                <!--</a>-->

                                    <a class="delete" data-id="{$v['id']}" href="javascript:;">
                                        <button class="btn btn-danger btn-sm" type="button">Delete</button>
                                    </a>
                                </td>
                            </tr>
                            {/volist}

                            </tbody>
                        </table>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
<!--body wrapper end-->

<!--footer section start-->
<footer>
    2014 &copy; AdminEx by <a href="http://www.tcode.me/" target="_blank">淘代码</a>
</footer>
<!--footer section end-->


</div>
<!-- main content end-->
</section>
{/block}


{block name="myjs"}
<!--data table-->
{js href="/static/layout/js/data-tables/jquery.dataTables.js"}
{js href="/static/layout/js/data-tables/DT_bootstrap.js"}

<!--script for editable table-->
{js href="/static/layout/js/editable-table.js"}

<!-- END JAVASCRIPTS -->
{js href="/static/admin/js/toastr.min.js"}
<script>
    // jQuery(document).ready(function () {
    //     EditableTable.init();
    // });
    //
    // $(function () {
    //     // 设置弹框参数
    //     toastr.options = {
    //         closeButton: true,// 是否显示关闭按钮
    //         progressBar: true,// 实现显示计时条
    //         timeOut: "3000",  // 自动关闭时间
    //         positionClass: "toast-top-right" // 提示位置
    //         // toast-top-full-width 顶端，宽度铺满整个屏幕
    //         // toast-top-left  顶端左边
    //     };
    // });
    //
    // // 执行ajax删除
    // function delAjax(id, row) {
    //     $.ajax({
    //         dataType: 'json',
    //         type: 'delete',
    //         url: '/category/' + id + '.html',
    //         success: function (data) {
    //             console.log(data);
    //             if (data.status) {
    //                 toastr.success(data.info);
    //                 row.remove();
    //             } else {
    //                 toastr.error(data.info, 'WARING');
    //             }
    //         },
    //         error: function () {
    //             alert('AJAX 请求出现错误!');
    //         }
    //     });
    // }


</script>
{/block}


